//
//  ScreeningViewController.m
//  结伴
//
//  Created by mo on 16/8/9.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "ScreeningViewController.h"
#import "ScreeningTableViewCell.h"
#import "ScreeningTableViewCellTwo.h"
#import "ScreeningTableViewCellThree.h"

@interface ScreeningViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView_main;

@end

@implementation ScreeningViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    self.title = @"筛选";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(leftButton:)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(rightButton:)];
    
}
- (void)leftButton:(UIBarButtonItem *)button{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)rightButton:(UIBarButtonItem *)button{
    
    [self.navigationController popToRootViewControllerAnimated:YES];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    id cell;
    static NSString *ID_cell = @"ScreeningTableViewCell";
    static NSString *ID_cellTwo = @"ScreeningTableViewCellTwo";
    static NSString *ID_cellThree = @"ScreeningTableViewCellThree";
    
    ScreeningTableViewCell *cellOne = [tableView dequeueReusableCellWithIdentifier:ID_cell];
    if (!cellOne) {
        
        cellOne = [[[NSBundle mainBundle] loadNibNamed:ID_cell owner:nil options:nil] lastObject];
    }
    
    ScreeningTableViewCellTwo *cellTwo = [tableView dequeueReusableCellWithIdentifier:ID_cellTwo];
    if (!cellTwo) {
        
        cellTwo = [[[NSBundle mainBundle] loadNibNamed:ID_cellTwo owner:nil options:nil] lastObject];
    }
    
    ScreeningTableViewCellThree *cellThree = [tableView dequeueReusableCellWithIdentifier:ID_cellThree];
    if (!cellThree) {
        
        cellThree = [[[NSBundle mainBundle] loadNibNamed:ID_cellThree owner:nil options:nil] lastObject];
    }
    

    if (indexPath.row == 0) {
        
        cellOne.contenterLabel.text = @"性别:";
        cellOne.iconName.image = [UIImage imageNamed:@""];
        cell = cellOne;
        
    }else if (indexPath.row == 1){
        
        cell = cellThree;
        
    }else if (indexPath.row == 2) {
        
        cellOne.contenterLabel.text = @"行程日期:";
        cellOne.iconName.image = [UIImage imageNamed:@""];
        cell = cellOne;
        
    }else if (indexPath.row == 3) {
        
        cell = cellTwo;
        
        
    }else if(indexPath.row == 4) {
        
        cellOne.contenterLabel.text = @"出发地:";
        cellOne.iconName.image = [UIImage imageNamed:@""];
        cell = cellOne;
        
    }else{
        
        cell = cellThree;
        
    }
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    CGFloat height = 50;
    if (indexPath.row == 0 || indexPath.row == 2 || indexPath.row == 4) {
        height = 45;
    }
    
    return height;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.1;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
